{% extends 'layout.html' %}

{% block content %}
    <div class="container">

        <div style="margin-bottom: 10px"> {# 按钮"新建部门"和面板表添加10像素的距离 #}
            <a class="btn btn-primary" href="/tools/prettynum/add/" target="_blank">
{#            <a class="btn btn-success" href="/tools/prettynum/add/" target="_blank">#}
{#                <span class="glyphicon glyphicon-plus-sign" aria-hidden="true"></span>#}
                新增靓号
            </a>
            <div style="float: right; width: 300px;">
                <form method="get">
                    <div class="input-group">
                        <input type="text" name="query" class="form-control" placeholder="Search for..."
                            value="{{ search_data }}">
                        <span class="input-group-btn">
                            <button class="btn btn-default" type="submit">
                                <span class="glyphicon glyphicon-search" aria-hidden="true"></span>
                            </button>
                        </span>

                    </div>
                </form>
            </div>
        </div>


        <div class="panel panel-default">
          <!-- Default panel contents -->
          <div class="panel-heading">
              <span class="glyphicon glyphicon-th-list" aria-hidden="true" style="margin-right: 5px;"></span>
              <span>靓号列表</span>
          </div>

          <!-- Table -->
          <table class="table table-bordered">  {# table-bordered  边框 #}
            <thead>
                <tr>
                    <th>ID</th>
                    <th>号码</th>
                    <th>价格</th>
                    <th>级别</th>
                    <th>状态</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
            {% for obj in querySet %}
            	<tr>
                    <th >{{ obj.id }}</th>
                    <td>{{ obj.mobile }}</td>
                    <td>{{ obj.price }}</td>
                    <td>{{ obj.get_level_display }}</td>
                    <td>{{ obj.get_status_display }}</td>
                    <td>
                        <a class="btn btn-primary btn-xs" href="/tools/prettynum/{{ obj.id }}/edit/">编辑</a>
                        <a class="btn btn-danger btn-xs" href="/tools/prettynum/{{ obj.id }}/delete/">删除</a>
                    </td>
                </tr>
            {% endfor %}

            </tbody>
          </table>
        </div>

    <!-- 分页导航 -->
        <ul class="pagination">
            {{ page_string }}
{#            <li><a href="?page=1">1</a></li>#}
{#            <li><a href="?page=2">2</a></li>#}
{#            <li><a href="?page=3">3</a></li>#}
        </ul>

{#        <!-- 分页导航 -->#}
{#        <nav aria-label="Page navigation">#}
{#            <ul class="pagination">#}
{#                {% if page_obj.has_previous %}#}
{#                    <li><a href="?page=1">&laquo; 首页</a></li>#}
{#                    <li><a href="?page={{ page_obj.previous_page_number }}">上一页</a></li>#}
{#                {% endif %}#}
{##}
{#                {% for num in paginator.page_range %}#}
{#                    {% if page_obj.number == num %}#}
{#                        <li class="active"><a href="?page={{ num }}">{{ num }}</a></li>#}
{#                    {% else %}#}
{#                        <li><a href="?page={{ num }}">{{ num }}</a></li>#}
{#                    {% endif %}#}
{#                {% endfor %}#}
{##}
{#                {% if page_obj.has_next %}#}
{#                    <li><a href="?page={{ page_obj.next_page_number }}">下一页</a></li>#}
{#                    <li><a href="?page={{ paginator.num_pages }}">尾页 &raquo;</a></li>#}
{#                {% endif %}#}
{#            </ul>#}
{#        </nav>#}


    </div>
{% endblock %}